| Name | Defense Meteorological Satellite Program (DMSP), Operational Line Scanner(OLS) | Suomi National Polar Orbiting Partnership (NPP), Visible Infrared Imaging Radiometer Suite (VIIRS) |
|---|---|---|
| Satellite | ||
| Availability | 1992 to 2014 | 2011 to Present |
| Spatial Resolution | 1 km | 0.5 km |
| Temporal Resolution | Daily (yearly on GEE) | Daily (monthly on GEE) |
| Radiance Digital Number (DN) | 6 bit numbers (0 - 64) | 7 bit numbers (0 - 128) |
//Use SRTM elevation data to remove pixels that represent oceans
var elev = ee.Image('srtm90_v4');
var elevation_mask = elev.mask();
//---DMSP---
//Select time
//DMSP is avaiable between 1992 and 2012 (yearly)
var DMSP_T1_a = '1993-01-01';
var DMSP_T1_b = '1993-12-31';
var DMSP_T2_a = '2012-01-01';
var DMSP_T2_b = '2012-12-31';
//Load data
var DMSP = ee.ImageCollection('NOAA/DMSP-OLS/NIGHTTIME_LIGHTS')
.select('stable_lights');
//Transform to Image using .mean as reducer and .updateMask to remove ocean pixels
var DMSP_T1 = DMSP.filterDate(DMSP_T1_a, DMSP_T1_b).mean()
.updateMask(elevation_mask);
var DMSP_T2 = DMSP.filterDate(DMSP_T2_a, DMSP_T2_b).mean()
.updateMask(elevation_mask);
//Calculate change
var DMSP_change = DMSP_T2.subtract(DMSP_T1);
//Display maps
Map.addLayer(DMSP_T1, {min:0, max:64}, 'DMSP T1');
Map.addLayer(DMSP_T2, {min:0, max:64}, 'DMSP T2');
Map.addLayer(DMSP_change, {min:-20, max:20 , palette: ['blue', 'white', 'red']}, 'DMSP T2-T1 rad');
//---VIRRS---
//Select time
//VIRRS is available between 2012 and present (monthly)
var VIIRS_T1_a = '2012-09-01';
var VIIRS_T1_b = '2012-10-31';
var VIIRS_T2_a = '2020-09-01';
var VIIRS_T2_b = '2020-10-31';
//Load data
var VIIRS = ee.ImageCollection('NOAA/VIIRS/DNB/MONTHLY_V1/VCMCFG')
.filterDate('2012-01-01', '2021-12-31')
.select('avg_rad');
// Transform to Image using .mean as reducer and .updateMask to remove ocean pixels
var VIIRS_T1 = VIIRS.filterDate(VIIRS_T1_a, VIIRS_T1_b).mean()
.updateMask(elevation_mask);
var VIIRS_T2 = VIIRS.filterDate(VIIRS_T2_a, VIIRS_T2_b).mean()
.updateMask(elevation_mask);
//Calculate change
var VIIRS_change = VIIRS_T2.subtract(VIIRS_T1);
//Display maps
Map.addLayer(VIIRS_T1, {min:0, max:128}, 'VIIRS T1');
Map.addLayer(VIIRS_T2, {min:0, max:128}, 'VIIRS T2');
Map.addLayer(VIIRS_change, {min:-20, max:20 , palette: ['blue', 'white', 'red']}, 'VIIRS T2-T1');
//*--------------------------------------
//Notes:
//DMSP used 6 bit numbers (0 - 64) while VIIRS usss 7 bit number (0-128)
//The gain for DMSP is high so there will be saturation in bright areas
//Select ROI
var ROI = ee.FeatureCollection("users/rmb623/nyc");
Map.addLayer(ROI, {}, 'ROI', 0);
Map.centerObject(ROI, 9);
//Calculate ROI area in km2
print('ROI Area km2', ROI.geometry().area().divide(1e6));
//DMSP ROI
var DMSP_chart = ui.Chart.image.seriesByRegion(
DMSP,
ROI.geometry(),
ee.Reducer.mean())
.setOptions({title: 'DMSP Night Light Radiance',
hAxis: {title: 'Year',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'Intensity',
minValue: 0},
colors: ['red']});
print(DMSP_chart);
//VIIRS ROI
var VIIRS_chart = ui.Chart.image.seriesByRegion(
VIIRS,
ROI.geometry(),
ee.Reducer.mean())
.setOptions({title: 'VIIRS Night Light Radiance',
hAxis: {title: 'Month',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'Intensity',
minValue: 0},
colors: ['red']});
print(VIIRS_chart);
| Name | National Agriculture Imagery (NAIP) | Sentinel-2 | Landsat (1-9) |
|---|---|---|---|
| Satellite | |||
| Availability | 2006, 2009, 2011, 2013, 2015, 2017, 2019 | 2016 - present | 1999 - present |
| Coverage | Continental US | Global | Global |
| Spatial Resolution | 1 m | 10 m | 30 m |
| Temporal Resolution | Yearly mosaic | 10 days (5 days from 2019) | 16 days |
| Spectral Bands | 4 | 13 | 11 |
| NDVI Bands | R + IR | B4 (665 nm) + B8 (833 nm) | B4 (660 nm) + B5 (860 nm) |
// --------------------------------
// ----- NAIP ---------------------
// --------------------------------
//Select ROI
var ROI = ee.FeatureCollection("users/rmb623/nyc");
Map.addLayer(ROI, {}, 'ROI', 0);
Map.centerObject(ROI, 9);
//Select time
//Yearly mosaics of 2006, 2009, 2011, 2013, 2015, 2017, 2019
var N_T1_a = '2011-01-01';
var N_T1_b = '2011-12-31';
var N_T2_a = '2015-01-01';
var N_T2_b = '2015-12-31';
//Get RGB visual imagery for ROI
var NAIP = ee.ImageCollection('USDA/NAIP/DOQQ').filterBounds(ROI);
var NAIP_T1 = NAIP.filterDate(N_T1_a, N_T1_b).mosaic().clip(ROI);
var NAIP_T2 = NAIP.filterDate(N_T2_a, N_T2_b).mosaic().clip(ROI);
//Plot red, green, and blue bands
Map.addLayer(NAIP_T1, {min: 0, max: 255, bands:['R','G','B']}, 'NAIP T1', 0);
Map.addLayer(NAIP_T2, {min: 0, max: 255, bands:['R','G','B']}, 'NAIP T2', 1);
//Calculate NDVI using red (R) and Near Infrared Band (N)
var NDVI_NAIP_T1 = NAIP_T1.normalizedDifference(['N', 'R']).rename('NDVI_NAIP');
var NDVI_NAIP_T2 = NAIP_T2.normalizedDifference(['N', 'R']).rename('NDVI_NAIP');
//Plot NDVI
Map.addLayer(NDVI_NAIP_T1, {min: -0.4, max: 0.6, palette: ['brown','white', 'green']}, 'NAIP NDVI T1 1m', 0);
Map.addLayer(NDVI_NAIP_T2, {min: -0.4, max: 0.6, palette: ['brown','white', 'green']}, 'NAIP NDVI T2 1m', 1);
//Plot NDVI histogram between T1 and T2
var NDVI_T1_T2 = NDVI_NAIP_T1.addBands(NDVI_NAIP_T2);
var ndvi_naip = ui.Chart.image.histogram({
image: NDVI_T1_T2,
region: ROI,
scale: 3,
maxPixels: 1e13})
.setSeriesNames(['NAIP T1', 'NAIP T2'])
.setOptions({title: 'NAIP NDVI Histograms for T1 and T2',
hAxis: {title: 'NDVI',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'Count',
titleTextStyle: {italic: false, bold: true}},
colors: ['cf513e', '1d6b99'],
opacity:[0.1,0.2]});
print(ndvi_naip);
// --------------------------------
// ----- Sentinel -----------------
// --------------------------------
//Select ROI
var ROI = ee.FeatureCollection("users/rmb623/nyc");
Map.addLayer(ROI, {}, 'ROI', 0);
Map.centerObject(ROI, 9);
//Select time
//Revisit time of 10 days 2016-2018, 5 days 2019-present
var S_T1_a = '2016-5-01';
var S_T1_b = '2016-9-30';
var S_T2_a = '2020-5-01';
var S_T2_b = '2020-9-30';
//Function to mask clouds using the detected cloud band "QA60"
var maskcloud_s2 = function(image) {
var QA60 = image.select(['QA60']);
return image
.updateMask(QA60.lt(1));
};
//Get RGB visual imagery for ROI
var sentinel = ee.ImageCollection('COPERNICUS/S2')
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 10)) // filter to only less cloudy images
.filterBounds(ROI)
.map(maskcloud_s2); // apply the function to all images
//Use median instead of mosaic to ensure that the low lying clouds are removed
var sentinel_T1 = sentinel.filterDate(S_T1_a,S_T1_b).median().clip(ROI);
var sentinel_T2 = sentinel.filterDate(S_T2_a,S_T2_b).median().clip(ROI);
//Plot red (B4), green (B3), and blue (B2) bands
Map.addLayer(sentinel_T1 ,{bands:['B4','B3','B2'], min:0,max:2500}, 'Sentinel 2 T1', 0);
Map.addLayer(sentinel_T2 ,{bands:['B4','B3','B2'], min:0,max:2500}, 'Sentinel 2 T2', 0);
//Calculate NDVI using red (B4) and Near Infrared Band (B8)
var ndvi_sentinel_t1 = sentinel_T1.normalizedDifference(['B8', 'B4']).rename('NDVI_Sentinel');
var ndvi_sentinel_t2 = sentinel_T2.normalizedDifference(['B8', 'B4']).rename('NDVI_Sentinel');
Map.addLayer(ndvi_sentinel_t1, {min:-0.3, max:0.8, palette: ['brown', 'white', 'green']}, 'Sentinel 2 NDVI T1 10m', 0);
Map.addLayer(ndvi_sentinel_t2, {min:-0.3, max:0.8, palette: ['brown', 'white', 'green']}, 'Sentinel 2 NDVI T2 10m', 0);
//Plot NDVI histogram between T1 and T2
var NDVI_T1_T2 = ndvi_sentinel_t1.addBands(ndvi_sentinel_t2);
var ndvi_sentinel = ui.Chart.image.histogram({
image: NDVI_T1_T2,
region: ROI,
scale: 10,
maxPixels: 1e13})
.setSeriesNames(['SENTINEL T1', 'SENTINEL T2'])
.setOptions({title: 'SENTINEL 2 NDVI Histograms for T1 and T2',
hAxis: {title: 'NDVI',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'Count',
titleTextStyle: {italic: false, bold: true}},
colors: ['cf513e', '1d6b99']});
print(ndvi_sentinel);
// --------------------------------
// ----- LANDSAT ------------------
// --------------------------------
//Select ROI
var ROI = ee.FeatureCollection("users/rmb623/nyc");
Map.addLayer(ROI, {}, 'ROI', 0);
Map.centerObject(ROI, 9);
//Select time
//Revisit time of 16 days 1999 - present
var L_T1_a = '2003-5-01';
var L_T1_b = '2003-9-30';
var L_T2_a = '2015-5-01';
var L_T2_b = '2015-9-30';
//Function to mask clouds
var maskcloud_L = function(image) {
var qa = image.select('pixel_qa');
// If the cloud bit (5) is set and the cloud confidence (7) is high
// or if the cloud shadow bit is set (3), then it's a bad pixel.
var cloud = qa.bitwiseAnd(1 << 5)
.and(qa.bitwiseAnd(1 << 7))
.or(qa.bitwiseAnd(1 << 3));
// Remove edge pixels that don't occur in all bands
var mask2 = image.mask().reduce(ee.Reducer.min());
return image.updateMask(cloud.not()).updateMask(mask2);
};
//Get RGB visual imagery for ROI
var landsat = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR').map(maskcloud_L).filterBounds(ROI);
var landsat_T1 = landsat.filterDate(L_T1_a,L_T1_b).median().clip(ROI);
var landsat_T2 = landsat.filterDate(L_T2_a,L_T2_b).median().clip(ROI);
//Plot red (B3), green (B2), and blue (B1) bands
Map.addLayer(landsat_T1 ,{bands:['B3','B2','B1'], min:0,max:2500}, 'Landsat 7 T1', 0);
Map.addLayer(landsat_T2 ,{bands:['B3','B2','B1'], min:0,max:2500}, 'Landsat 7 T2', 0);
//Calculate NDVI using red (B3) and Near Infrared Band (B4)
var landsat_ndvi_t1 = landsat_T1.normalizedDifference(['B4', 'B3']).rename('NDVI_Landsat_T1');
var landsat_ndvi_t2 = landsat_T2.normalizedDifference(['B4', 'B3']).rename('NDVI_Landsat_T2');
Map.addLayer(landsat_ndvi_t1, {min:-0.15, max:0.7, palette: ['brown', 'white', 'green']}, 'Landsat NDVI T1 30m', 0);
Map.addLayer(landsat_ndvi_t2, {min:-0.15, max:0.7, palette: ['brown', 'white', 'green']}, 'Landsat NDVI T2 30m', 0);
//Plot NDVI histogram between T1 and T2
var NDVI_T1_T2 = landsat_ndvi_t1.addBands(landsat_ndvi_t2);
var ndvi_landsat = ui.Chart.image.histogram({
image: NDVI_T1_T2,
region: ROI,
scale: 30,
maxPixels: 1e13})
.setSeriesNames(['LANDSAT T1', 'LANDSAT T2'])
.setOptions({title: 'LANDSAT NDVI Histograms for T1 and T2',
hAxis: {title: 'NDVI',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'Count',
titleTextStyle: {italic: false, bold: true}},
colors: ['cf513e', '1d6b99'],
opacity:0});
print(ndvi_landsat);
//NDVI calculation for timeseries
var ndvi_func = function (i) {
var ndvi = i.normalizedDifference (['B4', 'B3']).rename ('NDVI');
return i.addBands(ndvi);
};
var ndvi_landsat = landsat.map(ndvi_func).filterDate('2000-01-01','2020-12-31');
var timeseries = ui.Chart.image.seriesByRegion({
imageCollection: ndvi_landsat,
regions: ROI,
reducer: ee.Reducer.mean(),
band: 'NDVI',
scale: 30})
.setOptions({title: 'LANDSAT 7 - NDVI',
hAxis: {title: 'Year',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'NDVI',
titleTextStyle: {italic: false, bold: true}},
colors: ['red']});
print(timeseries);
| Name | Moderate Resolution Imaging Spectroradiometer (MODIS) on board Aqua and Terra | Thermal Infrared Sensor (TIRS) on board Landsat-8 |
|---|---|---|
| Satellite | ||
| Spatial Resolution | 1 km | 30 m |
| Temporal Resolution | daily, but provided in 8 days aggregates | 16 days |
| Collection Time | ~11:30 am and ~11:30 pm local time | ~10:30 am local time |
// --------------------------------
// ----- MODIS --------------------
// --------------------------------
//Select ROI
var ROI = ee.FeatureCollection("users/rmb623/nyc");
Map.addLayer(ROI, {}, 'ROI', 0);
Map.centerObject(ROI, 9);
//Select time
var T1 = "2016-07-01";
var T2 = "2016-07-10";
//Create heat palette
var pal = ['040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
'0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
'3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
'ff0000', 'de0101', 'c21301', 'a71001', '911003'];
//Function to convert K to C
function celcius_modis(img){
return img.multiply(0.02).subtract(273.15)
.rename(['modis_day_celcius', 'modis_night_celcius'])
.copyProperties(img, img.propertyNames());
}
//Load data (MODIS/MOD11A2 for pre-2017)
var modis = ee.ImageCollection('MODIS/MOD11A2')
.filterDate(T1 , T2)
.select(['LST_Day_1km', 'LST_Night_1km'])
.map(celcius_modis);
//Separate day and night
var modis_day = modis.select('modis_day_celcius').mean().clip(ROI);
var modis_night = modis.select('modis_night_celcius').mean().clip(ROI);
Map.addLayer(modis_day, {min:20, max:40 , palette: pal}, 'Modis Day');
Map.addLayer(modis_night, {min:20, max:40 , palette: pal}, 'Modis Night');
//Load another collection (MODIS/006/MOD11A2 for 2000-present)
var modis_chart = ee.ImageCollection('MODIS/006/MOD11A2')
.filterDate('2010-01-01', '2021-12-31')
.select(['LST_Day_1km','LST_Night_1km'])
.map(celcius_modis);
//Create timeseries for day (red) and night (blue)
var heat_time = ui.Chart.image.series({
imageCollection: modis_chart,
region: ROI,
reducer: ee.Reducer.mean(),
scale: 1000})
.setOptions({title: 'MODIS DAY & NIGHT (celcius)',
hAxis: {title: 'Year',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'Temperature (°C)',
titleTextStyle: {italic: false, bold: true}},
colors: ['red', 'blue']});
print(heat_time);
// --------------------------------
// ----- LANDSAT ------------------
// --------------------------------
//Select ROI
var ROI = ee.FeatureCollection("users/rmb623/nyc");
Map.addLayer(ROI, {}, 'ROI', 0);
Map.centerObject(ROI, 9);
//Select time
var T1 = "2016-07-01";
var T2 = "2016-07-10";
//Create heat palette
var pal = ['040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
'0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
'3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
'ff0000', 'de0101', 'c21301', 'a71001', '911003'];
//Function applying scalling and offset factor
function celcius_landsat(img){
return img.addBands(img.multiply(0.00341802) // scale
.add(149.0) // offset
.subtract(273.15)
.rename('landsat_day_celcius'));
}
//Load data, selecting images with less than 15% cloud cover
var landsat = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
.filter(ee.Filter.lt('CLOUD_COVER',15))
.select('ST_B10')
.map(celcius_landsat)
.select('landsat_day_celcius');
//Filter by date (T1 - T2)
var landsat_day = landsat.filterDate(T1,T2).mean().clip(ROI);
Map.addLayer(landsat_day, {min:20, max:45 , palette: pal}, 'Landsat Day');
//Plot time series
var landsat_chart = landsat.filterDate('2010-01-01', '2021-12-31');
var landsat_time = ui.Chart.image.series({
imageCollection: landsat_chart,
region: ROI,
reducer: ee.Reducer.max(),
scale: 1000})
.setOptions({title: 'LANDSAT DAY (celcius)',
hAxis: {title: 'Year',
titleTextStyle: {italic: false, bold: true}},
vAxis: {title: 'Temperature (°C)',
titleTextStyle: {italic: false, bold: true}},
colors: ['red']});
print(landsat_time);
// --------------------------------
// ----- Profile Line -------------
// --------------------------------
//Create a point profile line
function getRange(start, end, step) {
var range = [];
while (step > 0 ? end >= start : end <= start) {
range.push(start);
start += step;
}
return range;
}
var y = 40.6809; // the latitude of the profile line
var x1 = -74.0119; // the longitude of profile line beginning point
var x2 = -73.7325; // the longitude of profile line end point
var N = 1000; // the number of samples on the profile line
//Get coordinate points
var R = getRange(x1,x2,(x2-x1)/N);
//Transform coordinates into a FeatureCollection
var points = ee.FeatureCollection( R.map(function(i){
var point = ee.Geometry.Point([ee.Number(i), ee.Number(y)]) // create a new point feature with R[i] as longitude and y as latitude
return(ee.Feature(point).set({
lon:ee.Number(i), // add attributes lon
lat:ee.Number(y) // add attributes lat
}))
}))
Map.addLayer(points, {}, 'points');
//Stack all bands
var stack = modis_day
.addBands([modis_night, landsat_day])
.rename(['modis_day', 'modis_night', 'landsat_day']);
//Get temperature at each point
var collection = stack.reduceRegions({
reducer: ee.Reducer.max(),
collection: points,
scale: 1});
//Plot a scatter plot of the Modis profile line
var chart = ui.Chart.feature.byFeature({
features: collection,
xProperty: 'lon', // use longitude as the X axis
yProperties: ['modis_day','modis_night']}) // use Temperature as the y axis
.setChartType('ScatterChart')
.setOptions({title: 'Temperature Profile Line Modis',
hAxis: {title: 'Longitude',
titleTextStyle: {italic: false, bold: true},
viewWindow: {min: x1, max: x2}}, // x axis limit to start & end of the line
vAxis: {title: 'Temperature (°C)',
titleTextStyle: {italic: false, bold: true}},
pointSize: 1,
colors: ['red', 'blue']});
print(chart);
//Plot a scatter plot of the Landsat profile line
var chart = ui.Chart.feature.byFeature({
features: collection,
xProperty: 'lon', // use longitude as the X axis
yProperties: ['landsat_day']}) // use Temperature as the y axis
.setChartType('ScatterChart')
.setOptions({title: 'Temperature Profile Line Landsat',
hAxis: {title: 'Longitude',
titleTextStyle: {italic: false, bold: true},
viewWindow: {min: x1, max: x2}}, // x axis limit to start & end of the line
vAxis: {title: 'Temperature (°C)',
titleTextStyle: {italic: false, bold: true}},
pointSize: 1,
colors: [ 'orange']});
print(chart);
Surface Roughness and Backscattering
The strength of the return, or backscatter, is partially based upon relative roughness of the surface imaged. The smoother the surface, the more reflection away from the sensor, while rough surfaces give a much stronger return towards the imaging platform.
However, there are additional types of bounce mechanisms beyond specular and diffuse. In vegetation, volumetric scattering occurs when signals bounce around inside the vegetation imaged. In urban areas, the double bounce mechanism causes a strong bounce back to the sensor.
Wavelength
The wavelength of the SAR system influences the amount of ground penetration that occurs. X-band has the least penetration, scattering from the top of the canopy in vegetated areas. All three bands will penetrate dry sand, with stronger returns from both C-band and L-band. L-band has the most penetration overall, with returns from the ground in vegetated areas, strong returns from substances under dry alluvium, and deep penetration of ice and snow.
Polarization
Polarization refers to the direction of travel of an electromagnetic wave. A horizontal wave is transmitted so that it oscillates in a plane parallel to the surface imaged, while a vertical wave oscillates in a plane perpendicular to the surface imaged. There are four different polarization combinations commonly used by SAR sensors: VV, VH, HV and HH. The first letter indicates the polarization used to transmit the signal and the second letter indicates the polarization of the measured return. Polarimetry is an emerging field of SAR processing, used in a number of applications such as measuring vegetation properties, oceanography, geology, and disaster response.
Captures both the natural and built/artificial features of the environment
| Copernicus (TerraSAR-X & TanDEM-X) | Shuttle Radar Topography Mission (SRTM) | Advanced Land Observing Satellite (ALOS) |
|---|---|---|
| Worldwide at 30m planar resolution | Worldwide at 30m planar resolution | Worldwide at 30m planar resolution |
| 2019 | 2000 | 2012 |
Represents the bare-Earth surface, removing all natural and built features. A Digital Terrain model (DTM) augments a DEM by including vector features of the natural terrain, such as rivers and ridges.
Aerial platforms, temporal-spatial tradeoffs, characterization and change detection, national record and inventories
Ground-based observation platforms, spectral characterization, temporal characterization, agency records.
Fixed and mobile sensing platforms, sensor networks, data acquisition and processing.
Citizens as sensors, mobile sensing.
The Gridded Population of the World, (GPWv4)
| Observations | Count | Density |
|---|---|---|
//Load data
var pop_collection = ee.ImageCollection("CIESIN/GPWv411/GPW_UNWPP-Adjusted_Population_Count")
.select('unwpp-adjusted_population_count');
//Choose date range
var T1_start = '2000-01-01';
var T1_ends = '2000-12-31';
var T2_start = '2020-01-01';
var T2_ends = '2020-12-31';
//Pull population for date range
var T1_pop = pop_collection.filterDate(T1_start, T1_ends).first();
var T2_pop = pop_collection.filterDate(T2_start, T2_ends).first();
//Calculate population change
var T2T1_pop_change = T2_pop.subtract(T1_pop);
//Plot
Map.setCenter(-74.0060, 40.7128, 9); //New York, United States
Map.addLayer(T1_pop, {min: 0, max: 2000, palette: [ 'ffffff', 'red' ]}, 'Population T1');
Map.addLayer(T2_pop, {min: 0, max: 2000, palette: [ 'ffffff', 'red' ]}, 'Population T2');
Map.addLayer(T2T1_pop_change, { min:-300, max: 300, palette: ['blue','black','red']}, 'Pop Change T1-T2');
//Select ROI
var ROI = ee.FeatureCollection("users/rmb623/nyc");
Map.addLayer(ROI, {}, 'ROI', 0);
Map.centerObject(ROI, 9);
//Summary statistics
var changeStats = T2T1_pop_change.reduceRegion(
{reducer: ee.Reducer.mean()
.combine({reducer2: ee.Reducer.stdDev(), sharedInputs: true})
.combine({reducer2: ee.Reducer.percentile({percentiles:[25,50,75]}), sharedInputs: true})
.combine({reducer2: ee.Reducer.count(), sharedInputs: true}),
geometry: ROI.geometry()});
print(changeStats);
//Plot total population
var pop_total = ui.Chart.image.series(
pop_collection,
ROI,
ee.Reducer.sum()) //.mean() can be used for denisty
.setOptions({title: 'Total Population of NYC',
vAxis: {textStyle: {fontSize: 14}},
hAxis: {title: 'Year', format: 'yyyy', gridlines: {count: 7},
titleTextStyle: {italic: false, bold: true, fontSize:14},
textStyle: {fontSize: 14}}});
print(pop_total);